WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
hardware_base.h
Go to the documentation of this file.
1// WOLF - Copyright (C) 2020-2026
2// Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
3// Authors: Joan Solà Ortega (jsola@iri.upc.edu) and
4// Joan Vallvé Navarro (jvallve@iri.upc.edu)
5// All rights reserved.
6//
7// This file is part of WOLF: http://www.iri.upc.edu/wolf
8// WOLF is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License version 3
10// as published by the Free Software Foundation.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19#pragma once
20
21// Fwd dependencies
22namespace wolf
23{
24class Problem;
25class SensorBase;
26} // namespace wolf
27
28// Wolf includes
29#include "core/common/wolf.h"
31
32namespace wolf
33{
36class HardwareBase : public NodeBase, public std::enable_shared_from_this<HardwareBase>
37{
38 friend SensorBase;
39
40 private:
41 SensorBasePtrList sensor_list_;
42
43 public:
47 ~HardwareBase() override;
48 bool hasChildren() const override;
49
52 SensorBaseConstPtrList getSensorList() const;
53
56 SensorBasePtrList getSensorList();
57
62 SensorBaseConstPtr getSensor(const std::string& _sensor_name) const;
63
66 SensorBasePtr getSensor(const std::string& _sensor_name);
67
70 virtual void printHeader(int depth, //
71 bool factored_by, //
72 bool metric, //
73 bool state_blocks,
74 std::ostream& stream,
75 std::string _tabs = "") const;
76
79 void print(int depth, //
80 bool factored_by, //
81 bool metric, //
82 bool state_blocks,
83 std::ostream& stream = std::cout,
84 std::string _tabs = "") const;
85
88 virtual CheckLog localCheck(bool _verbose, std::ostream& _stream, std::string _tabs = "") const;
89
92 bool check(CheckLog& _log, bool _verbose, std::ostream& _stream, std::string _tabs = "") const;
93
94 private:
97 virtual SensorBasePtr addSensor(SensorBasePtr _sensor_ptr);
98};
99
100} // namespace wolf
101
102// IMPLEMENTATION
103
104namespace wolf
105{
106inline SensorBaseConstPtrList HardwareBase::getSensorList() const
107{
108 SensorBaseConstPtrList list_const;
109 for (auto&& obj_ptr : sensor_list_) list_const.push_back(obj_ptr);
110 return list_const;
111}
112
113inline SensorBasePtrList HardwareBase::getSensorList()
114{
115 return sensor_list_;
116}
117
118inline bool HardwareBase::hasChildren() const
119{
120 return not sensor_list_.empty();
121}
122
123} // namespace wolf
Log of a consistency check: whether it is consistent and the explanation of the inconsistencies.
Definition: check_log.h:30
Hardware: the sensors of the problem.
Definition: hardware_base.h:37
SensorBaseConstPtr getSensor(const std::string &_sensor_name) const
Returns a sensor by its name (nullptr if not found)
Definition: hardware_base.cpp:40
HardwareBase()
Constructor.
Definition: hardware_base.cpp:24
SensorBaseConstPtrList getSensorList() const
Returns the installed sensors.
Definition: hardware_base.h:106
void print(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream=std::cout, std::string _tabs="") const
Prints this node and, depending on the depth, its children.
Definition: hardware_base.cpp:68
bool hasChildren() const override
Returns whether the node has children in the Wolf tree.
Definition: hardware_base.h:118
virtual CheckLog localCheck(bool _verbose, std::ostream &_stream, std::string _tabs="") const
Checks the consistency of this node (not of its children)
Definition: hardware_base.cpp:81
~HardwareBase() override
Definition: hardware_base.cpp:29
bool check(CheckLog &_log, bool _verbose, std::ostream &_stream, std::string _tabs="") const
Checks the consistency of this node and its children, composing the log.
Definition: hardware_base.cpp:98
virtual void printHeader(int depth, bool factored_by, bool metric, bool state_blocks, std::ostream &stream, std::string _tabs="") const
Prints the information of this node (not of its children)
Definition: hardware_base.cpp:58
Base class for Nodes.
Definition: node_base.h:73
Base class of sensors: their state blocks (extrinsics and intrinsics, static or dynamic),...
Definition: sensor_base.h:128
Definition: capture_base.h:23